{%extends 'layout.html'%}
{%block main%}
<ol class="breadcrumb">
    <li><a href="#">内容首页</a></li>
    <li> <span>内容列表</span> </li>
</ol>
<h3>内容列表</h3>
<table class="table table-striped">
    <tr>
        <th>ID</th>
        <th>标题</th>
        <th>作者</th>
        <th>分类名称</th>
        <th>添加时间</th>
        <th>阅读量</th>
        <th>操作</th>
    </tr>
    {%for user in contents%}
    <tr>
        <td>{{user._id.toString()}}</td>
        <td>{{user.title}}</td>
        <td>{{user.user.username}}</td>
        <td>{{user.category.name}}</td>
        <td>{{user.addTime|date("Y年m月d日 H:i:s")}}</td>
        <td>{{user.views}}</td>
        <td>
            <a href="/admin/content/edit?_id={{user._id.toString()}}">修改</a>
            <a href="/admin/content/delete?_id={{user._id.toString()}}">删除</a>
        </td>
    </tr>
    {%endfor%}
</table>

<nav aria-label="...">
    <ul class="pager">
        <li class="previous"><a href="/admin/category?page={{page-1}}"><span aria-hidden="true">&larr;</span> 上一页</a>
        </li>
        <li>
            一共有{{count}}条数据,每页显示{{limit}}条数据,一共{{pages}}页,当前在第{{page}}页
        </li>
        <li class="next"><a href="/admin/category?page={{page+1}}">下一页 <span aria-hidden="true">&rarr;</span></a></li>
    </ul>
</nav>

{%endblock%}